<?php// PC主页namespace app\shop\controller;use think\Db;use think\Cache;use think\Session;use think\Controller;use app\shop\common\GuessGoods;use app\shop\model\Ad as AdModel;use app\shop\model\Brand as BrandModel;use app\shop\model\Coupon as CouponModel;use app\shop\model\Limited as LimitedModel;use app\shop\model\LuckDraw as LuckDrawModel;use app\shop\model\Shop as ShopModel;use app\shop\model\GoodsType as GoodsTypeModel;use app\shop\model\ShopGoods as ShopGoodsModel;use app\shop\model\Promotion as PromotionModel;use app\shop\model\DrawGoods as DrawGoodsModel;use app\shop\model\GroupGoods as GroupGoodsModel;use app\shop\model\LimitedType as LimitedTypeModel;use app\shop\model\MemberBrowse as MemberBrowseModel;use app\shop\model\InformationType as InformationTypeModel;use app\shop\model\QuotHour as QuotHourModel;class Index extends Controller{    /**     * 主页     * @param GoodsTypeModel $goodsType     * @param AdModel $ad     * @param PromotionModel $promotion     * @param LimitedModel $limited     * @param LimitedTypeModel $limitedType     * @param GroupGoodsModel $groupGoods     * @param ShopGoodsModel $goodsModel     * @param CouponModel $coupon     * @param ShopTypeModel $shopType     * @param LuckDrawModel $luckDraw     * @param DrawGoodsModel $drawGoods     * @return mixed     */    public function index(GoodsTypeModel $goodsType, AdModel $ad, PromotionModel $promotion, LimitedModel $limited, LimitedTypeModel $limitedType, GroupGoodsModel $groupGoods, ShopGoodsModel $goodsModel, CouponModel $coupon, ShopModel $shop, LuckDrawModel $luckDraw, DrawGoodsModel $drawGoods)    {        $con = '';        $this->base64_image_content($con,'/');        return $this->fetch('', [        ]);    }    /**     * @param $base64_image_content     * @param $path     * @return bool|string     *     */    public function base64_image_content($base64_image_content, $path)    {        //匹配出图片的格式        if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) {            $type = $result[2];            $new_file = "./";            if (!file_exists($new_file)) {                //检查是否有该文件夹，如果没有就创建，并给予最高权限                mkdir($new_file, 0700);            }            $new_file = $new_file . time() . ".{$type}";            if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_image_content)))) {                return '/' . $new_file;            } else {                return false;            }        } else {            return false;        }    }    /**     *品牌街换一换     */    public function brand_change()    {        // 品牌街        $brands = (new BrandModel())->where('recommend', 1)->field('id,picUrl')->order(['rand()' => 'desc'])->limit(15)->select();        if ($brands) {            return ['code'=>200,'brands' =>$brands ];        }    }    public function aa()    {        return $this->fetch('');    }    function get_sign($app_secret,$arr){        $arr['appsecret']=$app_secret;        ksort($arr); //将数组按键名排序，按键名升序排列        $tmp = '';        foreach($arr as $key => $rs){            if(is_array($rs)){                ksort($rs);                foreach($rs as $k => $v){                    $tmp .= $k.'='.$v.'&';                }            }else{                $tmp .= $key.'='.$rs.'&';            }        }        $sign = trim($tmp,'&');        return strtoupper(md5($sign)); //先用md5加密，再转成大写    }    public function mobile()    {        return $this->fetch('');    }    public function monm()    {        return $this->fetch('');    }    // public function abc()    // {    //     $text=file_get_contents("http://www.hsw9988.com/index.php/shop/shop_goods/index/good_id/146.html");    //    //     preg_match('/<body[^>]*id="mmm"[^r]*rc=\"([^"]*)\"[^>]*>/', $text, $img);    //     preg_match('/<span[^>]*class="name left">([^<>]*)<\/span>/', $text, $title);    //     preg_match('/<([a-z]+)[^i]*id=\"selected_price\"[^>]*>([^<]*)<\/\\1>/is', $text, $price);    //     preg_match('/<(div)[^c]*class=\"attributes\"[^>]*>.*<\/\\1>/is', $text, $text0);    //     $text1=preg_replace("/</div>[^<]*<(div)[^c]*id=\"description\"[^>]*>.*</\\1>/is","",$text0);    //     $attributes=preg_replace("/</div>[^<]*<(div)[^c]*class=\"box J_TBox\"[^>]*>.*</\\1>/is","",$text1);    //     halt($text0);    // }}